A computer's operating system, such as the Microsoft Windows operating system (“Windows”), may be configured to specify that each process have its own private virtual address space. By way of example, Windows uses a technique known as memory-mapping to load the components of a process (such as the executable file and any associated dynamic link libraries) from persistent storage (e.g., disk or tape) into memory (e.g., random access memory (“RAM”)). In order to allow memory-mapping to operate more efficiently, each component of a process may be assigned what is known as a preferred base address within the memory. As is known in the art, it is possible to set the base address of a component at design time.
While many developers do set base addresses at design time, this process does not ensure that a component will always load at its preferred base address. For example, an operating system may not be able to load a component of a process at its preferred base address if the operating system has already loaded some other process component at that address. If any component of the process cannot be loaded at its preferred base address, the operating system must perform additional logic to relocate that component to a different location in memory. The process of relocating a component consumes valuable time and memory resources.
Thus, there remains a need for ensuring that each component of a process loads at its preferred base address. There further remains a need for optimally determining the correct preferred base addresses of a component prior to run time.